package com.doubi.controller.api;

import com.doubi.constants.SystemConstants;
import com.doubi.model.sys.THelpCenter;
import com.doubi.modelvo.sys.THelpCenterVo;
import com.doubi.service.ApiHelpCenterService;
import com.doubi.vo.AppUiModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@CrossOrigin
@RequestMapping("Api/HelpCenter")
@Api(value = "帮助中心", tags = "帮助中心模块")
public class ApiHelpCenterController {
    @Autowired
    private ApiHelpCenterService apiHelpCenterService;


    @ApiOperation(value = "帮助中心")
    @GetMapping("HelpCenterList")
    @ResponseBody
    public AppUiModel<List<THelpCenterVo>> helpCenterList() {
        return apiHelpCenterService.getHelpCenterList(SystemConstants.HelpCenter.TYPE_1);
    }

    @ApiOperation(value = "关于我们")
    @GetMapping("AboutUsList")
    @ResponseBody
    public AppUiModel<List<THelpCenterVo>> aboutUsList() {
        return apiHelpCenterService.getHelpCenterList(SystemConstants.HelpCenter.TYPE_2);
    }

    @ApiOperation(value = "帮助中心详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "oid", value = "唯一标识", required = true, dataType = "string"),
    })
    @GetMapping("HelpCenterDetails")
    @ResponseBody
    public AppUiModel<THelpCenterVo> helpCenterDetails(String oid) {
        return apiHelpCenterService.getHelpCenterDetails(oid);
    }

}
